﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RENIT.DragNDropUpload.Utils
{
    public static class AssebliesDetector
    {
        public static bool IsLoaded(string assemblyName)
        {
            bool ret= false;
            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                if (assembly.FullName.ToString().Equals(assemblyName, StringComparison.InvariantCultureIgnoreCase))
                {
                    ret = true; 
                }
            }
            return ret;
        }

        public static bool IsLoadedAny(string assemblyNamePart)
        {
            assemblyNamePart = assemblyNamePart.ToLowerInvariant();
            bool ret = false;
            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
                if (assembly.FullName.ToString().ToLowerInvariant().Contains(assemblyNamePart))
                {
                    ret = true;
                }
            }
            return ret;
        }

    }
}
